package com.swagger.demo.entity;

import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

/**
 * @ApiModel 中必须用description，不能用value
 * 否则无法识别
 *
 *
 * 支持JsonView的继承关系
 * 支持泛型类、泛型字段、继承的字段、嵌套对象
 */
@ApiModel(description = "用户对象")
public class User {

    public interface UserSimpleView {
    }

    public interface UserDetailView extends UserSimpleView {
    }

    @ApiModelProperty(value = "姓名", required = true)
    @JsonView(UserSimpleView.class)
    private String username;

    @ApiModelProperty(value = "生日", required = true)
    @JsonView(UserDetailView.class)
    private String birthday;

    @ApiModelProperty(value = "监护人", required = true)
    @JsonView(UserSimpleView.class)
    private List<User> guardian;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public List<User> getGuardian() {
        return guardian;
    }

    public void setGuardian(List<User> guardian) {
        this.guardian = guardian;
    }
}
